package com.kly.cashmall.utils;

import java.lang.reflect.Field;

/**
 * @author zxp
 * @since 27/10/21
 */
public class ReflectUtil {

    public ReflectUtil() {
    }

    public static <T> Object getField(Class<T> clazz, T who, String filedName) {
        try {
            Field field = clazz.getDeclaredField(filedName);
            if (field != null) {
                field.setAccessible(true);
                return field.get(who);
            } else {
                return null;
            }
        } catch (Exception var4) {
            var4.printStackTrace();
            return null;
        }
    }

}
